        <table class='table table-bordered'>
            <tr>
                <th colspan="2">
                    <a
                        ng-init="hide_all = false"
                        ng-click="hide_all = !hide_all; {% for environment in test_results.environments -%} hide_{{ environment.id }} = hide_all; {% endfor %}"
                        class="toggle-test-results">
                        <i ng-hide="!hide_all" class="fa fa-minus"></i>
                        <i ng-hide="hide_all" class="fa fa-plus"></i>
                    </a>
                    {{ _('Collapse/expand all') }}
                </th>
            </tr>
        </table>

        {% for environment in test_results.environments %}
        <table id='tests-{{ environment.id }}' class='test-results-box table table-bordered' ng-show='match("tests-{{environment.id}}") || match("details-{{environment.id}}")'>
            <thead>
                <tr>
                    <th colspan="2">
                        {% set hide_env = 'hide_' + string(environment.id) -%}
                        <a ng-click="{{ hide_env }} = !{{ hide_env }}" class="toggle-test-results">
                            <i ng-hide="!{{ hide_env }}" class="fa fa-minus"></i>
                            <i ng-hide="{{ hide_env }}" class="fa fa-plus"></i>
                        </a>
                        {{ environment }}
                        {% with status=environment.status %}
                            {% include "squad/_test_results_summary.jinja2" %}
                        {% endwith %}
                    </th>
                </tr>
            </thead>
            <tbody ng-hide="!{{ hide_env }}" aria-hidden="false">
                <tr>
                    <th>{{ _('Suite') }}</th>
                    <th>{{ _('Test Results') }}</th>
                </tr>
                {% for suite, statuses in environment.suites %}
                <tr>
                    <td>{{ suite }}</td>
                    <td>
                    {% for status in statuses %}
                        <a href="{{testrun_suite_tests_url(project.group, project, build, status)}}">{% include "squad/_test_results_summary.jinja2" %}</a>
                        {% if status.test_run.attachments.all()|length > 0  %}
                        {% with tr_id = status.test_run.id%}
                        {% set download_key = '%s-%s-%s' % (suite, environment, tr_id) %}
                            <select
                                name="attachment"
                                data-toggle="tooltip"
                                title="{{ _('Download Attachment') }}"
                                class="form-control-lg"
                                style="width: 40%;"
                                ng-model='selected_attachment["{{ download_key }}"]'
                                ng-change='show_download_button("{{ download_key }}")'
                                ng-cloak
                                >
                                <option value="" disabled selected hidden>Download Attachment</option>
                                {% for attachment in status.test_run.attachments.all() %}
                                    <option
                                        ng-init='attachments_visibility["{{ download_key }}"]["{{ attachment.filename }}"] = false'
                                        value="{{ attachment.filename }}"
                                    >
                                        {{ attachment.filename }}
                                    </option>
                                {% endfor %}
                            </select>
                            {% for attachment in status.test_run.attachments.all() %}
                            {% set download_url = download_build_attachments_url(project.group.slug, project.slug, build.version, tr_id, attachment.filename) %}
                                <a
                                    href="{{ download_url }}"
                                    value ="{{ _('Download') }}"
                                    class="btn btn-default"
                                    data-toggle="tooltip"
                                    title="Download"
                                    ng-cloak
                                    ng-hide='!attachments_visibility["{{ download_key }}"]["{{ attachment.filename }}"]'
                                    />
                                    <i class='fa fa-download'>&nbsp;</i>
                                </a>
                                {% if statuses|length > 1 %}
                                    <br/>
                                {% endif %}
                            {% endfor %}
                        {% endwith %}
                        {% else%}
                          {% if statuses|length > 1 %}
                              <br/>
                          {% endif %}
                        {% endif %}

                    {% endfor %}
                    </td>
                </tr>
                {% endfor %}
            </tbody>
        </table>
        {% endfor %}
